package spring.cn.edu.scau.cmi.huxiantao.client;

import spring.cn.edu.scau.cmi.huxiantao.domain.Student;
import spring.cn.edu.scau.cmi.huxiantao.util.ApplicationContextFactory;
import javafx.application.Application;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.*;
import javafx.scene.control.TextArea;
import javafx.stage.Stage;

public class SpringClient extends Application {
	@FXML
	private TextArea textArea;
	
	
	@Override
	public void start(Stage primaryStage) throws Exception {
		Parent root=FXMLLoader.load(getClass().getResource("/spring/GUI.fxml"));
		Scene scene=new Scene(root);
		primaryStage.setScene(scene);
		primaryStage.setTitle("实验8 Spring框架");
		primaryStage.show();
	}

	public static void main(String[] args) {
		launch();
	}
	
	@FXML
	private void getStudentBean() {
		Student student=(Student)ApplicationContextFactory.getContext().getBean("huxiantao");
		String msg=student.getName()+"  的毕业设计指导导师是： "+student.getTutor().getName()+"\n";
		textArea.setText(textArea.getText()+msg);
	}
}
